#pragma once

#include "imconfig.h"
#include "imgui.h"
#include "imgui_impl_dx11.h"
#include "imgui_impl_win32.h"
#include "imgui_internal.h"
#include "imstb_rectpack.h"
#include "imstb_textedit.h"
#include "imstb_truetype.h"
#include "Font.h"

//#include <time.h>
#include <string.h>
//#include <iostream>
#include <d3d11.h>
#pragma comment(lib,"d3d11.lib")

// 项目专用函数库
#include "GetDownloadCommon.h"





void CMD_Download_Success(float& ScalingRatio, bool& Download_Success) {
    static bool Download_WinPos2 = true;//用于初始化窗口位置
    int Screen_Width{ GetSystemMetrics(SM_CXSCREEN) };//获取显示器的宽
    int Screen_Heigth{ GetSystemMetrics(SM_CYSCREEN) };//获取显示器的高
    if (Download_WinPos2)//初始化窗口
    {
        ImGui::SetNextWindowPos({ float(Screen_Width - 213 * ScalingRatio) / 2,float(Screen_Heigth - 86 * ScalingRatio) / 2 });
        Download_WinPos2 = false;//初始化完毕
    }
    ImGui::Begin("下载功能提示", &Download_Success, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking);//开始绘制窗口
    ImGui::Text("成功打开程序的官网链接！");
    ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.117f, 0.655f, 0.137f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.117f, 0.555f, 0.137f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.117f, 0.455f, 0.137f, 1.0f));
    if (ImGui::Button("好的"))
        Download_Success = false;
    ImGui::PopStyleColor(3);
    ImGui::End();
}


void CMD_Download_Fail(float& ScalingRatio, bool& Download_Fail) {
    static bool Download_WinPos2 = true;//用于初始化窗口位置
    int Screen_Width{ GetSystemMetrics(SM_CXSCREEN) };//获取显示器的宽
    int Screen_Heigth{ GetSystemMetrics(SM_CYSCREEN) };//获取显示器的高
    if (Download_WinPos2)//初始化窗口
    {
        ImGui::SetNextWindowPos({ float(Screen_Width - 213 * ScalingRatio) / 2,float(Screen_Heigth - 86 * ScalingRatio) / 2 });
        Download_WinPos2 = false;//初始化完毕
    }
    ImGui::Begin("下载功能提示", &Download_Fail, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking);//开始绘制窗口
    ImGui::Text("打开程序的官网链接失败！");
    ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.75f, 0.1f, 0.1f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.75f, 0.25f, 0.25f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.75f, 0.4f, 0.4f, 1.0f));
    if (ImGui::Button("取消下载"))
        Download_Fail = false;
    ImGui::PopStyleColor(3);
    ImGui::End();
}